package route

import (
	"github.com/gin-gonic/gin"
	"github.com/vueadmin/app/admin/internal/handler/goods"
	"github.com/vueadmin/app/admin/internal/middle"
	"github.com/vueadmin/app/admin/internal/svc"
	"github.com/vueadmin/middleware"
	"github.com/vueadmin/utils/conv"
)

type Goods struct{}

/**
 * @description(商品管理路由)
 * @buildcode(true)
*/
func (Goods) RegisterRoute(route *gin.Engine, svcCtx *svc.ServiceContext) {
	r := route.Group(svcCtx.Config.Prefix)
	r.Use(middleware.JwtVerifyMiddleware(conv.String(svcCtx.Config.Jwt)), middle.NewBeforActionMiddleware(svcCtx).Handle())

	r.POST("/Goods/index", func(c *gin.Context) {goods.GetPageList(c, svcCtx)})               //数据列表
	r.POST("/Goods/updateExt", func(c *gin.Context) {goods.UpdateExt(c, svcCtx)})               //修改排序开关
	r.POST("/Goods/add", func(c *gin.Context) {goods.Add(c, svcCtx)})               //添加
	r.POST("/Goods/update", func(c *gin.Context) {goods.Update(c, svcCtx)})               //修改
	r.POST("/Goods/getUpdateInfo", func(c *gin.Context) {goods.GetUpdateInfo(c, svcCtx)})               //修改
	r.POST("/Goods/delete", func(c *gin.Context) {goods.Delete(c, svcCtx)})               //删除
	r.POST("/Goods/detail", func(c *gin.Context) {goods.Detail(c, svcCtx)})               //查看详情
	r.POST("/Goods/getFieldList", func(c *gin.Context) {goods.GetFieldList(c, svcCtx)})               //查询列表
	r.POST("/Goods/getClassId", func(c *gin.Context) {goods.GetClassIdList(c, svcCtx)})               //查询所属分类联动
}

